cmake_minimum_required(VERSION 3.0)
project(libgnurx C)

add_library(libgnurx src/regex.c)
target_include_directories(libgnurx PRIVATE "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/src")
set_target_properties(libgnurx PROPERTIES PUBLIC_HEADER "src/regex.h")
if(MSVC)
        #关闭编译警告
        add_definitions(/wd4267 /wd4018 /wd4312 /wd4311 /wd4996)
        message(STATUS "optional:/wd4267 /wd4108 /wd4312 /wd4311 /wd4996")
endif(MSVC)
if(CMAKE_COMPILER_IS_GNUCC)
        #关闭编译警告
        add_definitions(-Wno-int-to-pointer-cast -Wno-pointer-to-int-cast)
        message(STATUS "-Wno-int-to-pointer-cast -Wno-pointer-to-int-cast")
endif(CMAKE_COMPILER_IS_GNUCC)
install(TARGETS libgnurx DESTINATION "."
        PUBLIC_HEADER DESTINATION include
        RUNTIME DESTINATION bin
        ARCHIVE DESTINATION lib
        LIBRARY DESTINATION lib
        )
